﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.LongER.Framework.Utils;
using Com.LongER.UI;
using Com.LongER.Business.ZDH002;
using Com.LongER.Framework.Utils.LogUtils;

public partial class ZDH002 : ABasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            //画面ID
            Label lblPageId = (Label)Master.FindControl("lblPageId");
            lblPageId.Text = "ZDH002";

            //画面处理名
            Label lblPageName = (Label)Master.FindControl("lblPageName");
            lblPageName.Text = "车辆详细管理画面";

            //清空画面中的输入框
            #region
            proc清空_Init("0");
            #endregion
        }

        //autocomplete
        this.txt所属区分.Text = this.hid所属区分.Value;
        this.txt运输形态.Text = this.hid运输形态.Value;
        this.txt车辆形态.Text = this.hid车辆形态.Value;
        this.txt车辆状态.Text = this.hid车辆状态.Value;
    }
    protected void btn主菜单_Click(object sender, EventArgs e)
    {
        Response.Redirect("/LongER/ZAH003.aspx");
    }


    protected void btn执行_Click(object sender, EventArgs e)
    {
        //初期化处理
        #region
        //错误信息
        Label lblMsgCD = (Label)Master.FindControl("lblMsgCD");
        Label lblMsg = (Label)Master.FindControl("lblMsg");
        lblMsgCD.Text = "";
        lblMsg.Text = "";

        #endregion

        //处理区分进行确认
        if (this.txt处理区分.Text == string.Empty) //处理区分为空的场合
        {
            this.SetMessage("GTH000", "IGTH000001", MSG_LEVEL.Info);
            this.AddCssClass(this.txt处理区分, CSS_TEXT_ERROR);
            return;
        }
        else if (this.txt处理区分.Text == "1") //处理区分为1(查询)的场合
        {
            #region
            //查询时，各个控件的属性进行控制
            //proc清空_Init(this.txt处理区分.Text);

            //车牌号为空时
            if (this.txt车牌号.Text == string.Empty)
            {
                this.SetMessage("GTH002", "IGTH002002", MSG_LEVEL.Error);
                this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                return;
            }

            //通过车牌号进行查询
            CZDH002 instance = new CZDH002();
            ZDH002DS.M_CHELIANGDataTable dt = instance.GetMCHEDetail(this.txt车牌号.Text);
            if (dt.Count <= 0)
            {
                //查询失败
                this.SetMessage("GTH002", "IGTH002001", MSG_LEVEL.Error);
                this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                this.txt车牌号.Focus();
                return;
            }
            else
            {
                this.SetMessage("GTH002", "IGTH002000", MSG_LEVEL.Info);
                this.txt所属区分CD.Text = dt[0].SHO.ToString();
                this.txt所属区分.Text = dt[0].SSQF_HANZI.ToString();
                this.txt运输形态CD.Text = dt[0].YUNSHU_XINGTAI.ToString();
                this.txt运输形态.Text = dt[0].YSXT_HANZI.ToString();

                this.txt车辆形态CD.Text = dt[0].YUNSHU_XINGZHI.ToString();
                this.txt车辆形态.Text = dt[0].YSXZ_HANZI.ToString();

                this.txt车辆状态CD.Text = dt[0].CHELIANG_YUNYIN_ZHUANGTAI.ToString();
                this.txt车辆状态.Text = dt[0].CLZT_HANZI.ToString();

                this.txt车长.Text = dt[0].CHE_CHANG.ToString();
                this.txt车宽.Text = dt[0].CHE_KUAN.ToString();
                this.txt可承载重量.Text = dt[0].ZHUANGZAI_ZHONGLIANG.ToString();

                this.txt使用年数_Year.Text = dt[0].USED_YEARS.ToString();
                //this.txt使用年数_Month.Text = dt[0].USERID_HANZI.ToString();
                this.txt年检有效日期_Year.Text = dt[0].CHK_YOUXIAO_DATE.ToString();
                //this.txt年检有效日期_Month.Text = dt[0].USERID_HANZI.ToString();

                this.txt车主CD.Text = dt[0].OWER_CD.ToString();
                this.txt车主.Text = dt[0].KEHU_HANZI.ToString();
                this.txt车主联系电话1.Text = dt[0].TEL_NUM1.ToString();
                this.txt车主联系电话2.Text = dt[0].TEL_NUM2.ToString();

                this.txt车主传真号.Text = dt[0].FAX1.ToString();
                this.txt车主邮箱.Text = dt[0].MAIL_ADDR.ToString();

                this.txt主驾驶员CD.Text = dt[0].JIASHIYUAN_ZHU.ToString();
                this.txt主驾驶员.Text = dt[0].STAFF_HANZI_ZHU.ToString();
                this.txt主驾驶员联系电话.Text = dt[0].MOBIL1_ZHU.ToString();
                this.txt主驾驶员驾龄.Text = dt[0].JIALING_ZHU.ToString();
                this.txt主驾驶员准驾类型.Text = dt[0].JIAZHAO_TYPE_ZHU.ToString();

                this.txt副驾驶员CD.Text = dt[0].JIASHIYUAN_FU.ToString();
                this.txt副驾驶员.Text = dt[0].STAFF_HANZI_FU.ToString();
                this.txt副驾驶员联系电话.Text = dt[0].MOBIL1_FU.ToString();
                this.txt副驾驶员驾龄.Text = dt[0].JIALING_FU.ToString();
                this.txt副驾驶员准驾类型.Text = dt[0].JIAZHAO_TYPE_FU.ToString();

                this.txt备注.Text = dt[0].BEIZHU.ToString();


                this.txt车牌号.Focus();
            }
            #endregion

        }
        else if (this.txt处理区分.Text == "2") //处理区分为2(登记)的场合
        {
            //登录时，各个控件的属性进行控制
            proc清空_Init(this.txt处理区分.Text);

            #region
            //登记时，各个控件的值进行检查

            //车牌号的值进行检查
            #region
            if (this.txt车牌号.Text.Trim() == string.Empty)
            {
                //车牌号为空的场合,退出登陆
                this.SetMessage("ZDH002", "IZDH002000", MSG_LEVEL.Error);
                this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                return;
            }
            else
            {
                //对车牌号进行查询
                CZDH002 instanceSelectMChe = new CZDH002();
                ZDH002DS.M_CHELIANGDataTable dtSelectMChe = instanceSelectMChe.GetMCHEDetail(this.txt车牌号.Text);
                if (dtSelectMChe.Count > 0)
                {
                    //车牌号已存在场合,退出登陆
                    this.SetMessage("ZDH002", "IZDH002006", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                    this.txt车牌号.Focus();
                    return;
                }
            }
            #endregion

            //车主的值进行检查
            #region
            //车主的值空的场合，退出登陆
            if (this.txt车主CD.Text.Trim() == string.Empty)
            {
                this.SetMessage("ZDH002", "IZDH002000", MSG_LEVEL.Error);
                this.AddCssClass(this.txt车主CD, CSS_TEXT_ERROR);
                this.txt车主CD.Focus();
                return;
            }
            else
            {
                //对车主进行查询
                CZDH002 instanceSelectChezhu = new CZDH002();
                ZDH002DS.M_KEHUDataTable dtSelectChezhu = instanceSelectChezhu.GetCheZhuDetail(this.txt车主CD.Text);
                if (dtSelectChezhu.Count <= 0)
                {
                    //车主在客户表中不存在的场合，退出登陆
                    this.SetMessage("ZDH002", "IZDH002001", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt车主CD, CSS_TEXT_ERROR);
                    this.txt车主CD.Focus();
                    return;
                }
                else
                {
                    this.txt车主.Text = dtSelectChezhu[0].KEHU_HANZI.ToString();
                    this.txt车主联系电话1.Text = dtSelectChezhu[0].TEL_NUM1.ToString();
                    this.txt车主联系电话2.Text = dtSelectChezhu[0].TEL_NUM2.ToString();
                    this.txt车主传真号.Text = dtSelectChezhu[0].FAX1.ToString();
                    this.txt车主邮箱.Text = dtSelectChezhu[0].MAIL_ADDR.ToString();
                }
            }
            #endregion

            //主驾驶员的值进行检查
            #region
            //主驾驶员的值空的场合
            if (this.txt主驾驶员CD.Text.Trim() == string.Empty)
            {
                this.SetMessage("ZDH002", "IZDH002002", MSG_LEVEL.Error);
                this.AddCssClass(this.txt主驾驶员CD, CSS_TEXT_ERROR);
                this.txt主驾驶员CD.Focus();
                return;
            }
            else
            {
                //对主驾驶员进行查询
                CZDH002 instanceSelectStaff = new CZDH002();
                ZDH002DS.M_STAFFDataTable dtSelectStaff = instanceSelectStaff.GetJiaShiYuanDetail(this.txt主驾驶员CD.Text);
                if (dtSelectStaff.Count <= 0)
                {
                    //主驾驶员在员工表中不存在的场合，退出登陆
                    this.SetMessage("ZDH002", "IZDH002003", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt主驾驶员CD, CSS_TEXT_ERROR);
                    this.txt主驾驶员CD.Focus();
                    return;
                }
                else
                {
                    this.txt主驾驶员.Text = dtSelectStaff[0].STAFF_HANZI.ToString();
                    this.txt主驾驶员联系电话.Text = dtSelectStaff[0].MOBIL1.ToString();
                    this.txt主驾驶员驾龄.Text = dtSelectStaff[0].JIALING.ToString();
                    this.txt主驾驶员准驾类型.Text = dtSelectStaff[0].JIAZHAO_TYPE.ToString();
                }
            }
            #endregion

            //副驾驶员的值进行检查
            #region
            //副驾驶员的值空的场合
            if (this.txt副驾驶员CD.Text.Trim() == string.Empty)
            {
                this.SetMessage("ZDH002", "IZDH002004", MSG_LEVEL.Error);
                this.AddCssClass(this.txt副驾驶员CD, CSS_TEXT_ERROR);
                this.txt副驾驶员CD.Focus();
                return;
            }
            else
            {
                //对副驾驶员进行查询
                CZDH002 instanceSelectStaff = new CZDH002();
                ZDH002DS.M_STAFFDataTable dtSelectStaff = instanceSelectStaff.GetJiaShiYuanDetail(this.txt副驾驶员CD.Text);
                if (dtSelectStaff.Count <= 0)
                {
                    //副驾驶员在员工表中不存在的场合，退出登陆
                    this.SetMessage("ZDH002", "IZDH002005", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt副驾驶员CD, CSS_TEXT_ERROR);
                    this.txt副驾驶员CD.Focus();
                    return;
                }
                else
                {
                    this.txt副驾驶员.Text = dtSelectStaff[0].STAFF_HANZI.ToString();
                    this.txt副驾驶员联系电话.Text = dtSelectStaff[0].MOBIL1.ToString();
                    this.txt副驾驶员驾龄.Text = dtSelectStaff[0].JIALING.ToString();
                    this.txt副驾驶员准驾类型.Text = dtSelectStaff[0].JIAZHAO_TYPE.ToString();
                }
            }
            #endregion

            //执行登记
            #region
            Boolean isInserted = false;
            CZDH002 instance = new CZDH002();
            isInserted = instance.InsertMChe(this.txt车牌号.Text, this.txt所属区分CD.Text, this.txt车主CD.Text, this.txt主驾驶员CD.Text, this.txt副驾驶员CD.Text
                                                 , this.txt运输形态CD.Text, this.txt车辆形态CD.Text, this.txt车辆形态CD.Text
                                                 , this.txt车辆状态CD.Text, decimal.Parse(this.txt可承载重量.Text)
                                                 , decimal.Parse(this.txt车长.Text), decimal.Parse(this.txt车宽.Text), int.Parse(this.txt使用年数_Year.Text), this.txt年检有效日期_Year.Text
                                                 ,this.txt备注.Text);
            if (!isInserted)
            {
                //登记失败
                this.SetMessage("GTH003", "IGTH003002", MSG_LEVEL.Error);
                this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                this.txt车牌号.Focus();
            }
            else
            {
                //登记成功
                this.SetMessage("GTH003", "IGTH003000", MSG_LEVEL.Info);
                this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                this.txt车牌号.Focus();
            }
            #endregion

            #endregion
        }
        else if (this.txt处理区分.Text == "3") //处理区分为1(订正)的场合
        {
            #region
            //订正时，各个控件的属性进行控制
            proc清空_Init(this.txt处理区分.Text);


            //车牌号的值进行检查
            #region
            if (this.txt车牌号.Text.Trim() == string.Empty)
            {
                //车牌号为空的场合,退出登陆
                this.SetMessage("ZDH002", "IZDH002000", MSG_LEVEL.Error);
                this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                return;
            }
            else
            {
                //对车牌号进行查询
                CZDH002 instanceSelectMChe = new CZDH002();
                ZDH002DS.M_CHELIANGDataTable dtSelectMChe = instanceSelectMChe.GetMCHEDetail(this.txt车牌号.Text);
                if (dtSelectMChe.Count <= 0)
                {
                    //车牌号不存在场合,退出登陆
                    this.SetMessage("ZDH002", "IZDH002007", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                    this.txt车牌号.Focus();
                    return;
                }
            }
            #endregion

            //车主的值进行检查
            #region
            //车主的值空的场合，退出登陆
            if (this.txt车主CD.Text.Trim() == string.Empty)
            {
                this.SetMessage("ZDH002", "IZDH002000", MSG_LEVEL.Error);
                this.AddCssClass(this.txt车主CD, CSS_TEXT_ERROR);
                this.txt车主CD.Focus();
                return;
            }
            else
            {
                //对车主进行查询
                CZDH002 instanceSelectChezhu = new CZDH002();
                ZDH002DS.M_KEHUDataTable dtSelectChezhu = instanceSelectChezhu.GetCheZhuDetail(this.txt车主CD.Text);
                if (dtSelectChezhu.Count <= 0)
                {
                    //车主在客户表中不存在的场合，退出登陆
                    this.SetMessage("ZDH002", "IZDH002001", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt车主CD, CSS_TEXT_ERROR);
                    this.txt车主CD.Focus();
                    return;
                }
                else
                {
                    this.txt车主.Text = dtSelectChezhu[0].KEHU_HANZI.ToString();
                    this.txt车主联系电话1.Text = dtSelectChezhu[0].TEL_NUM1.ToString();
                    this.txt车主联系电话2.Text = dtSelectChezhu[0].TEL_NUM2.ToString();
                    this.txt车主传真号.Text = dtSelectChezhu[0].FAX1.ToString();
                    this.txt车主邮箱.Text = dtSelectChezhu[0].MAIL_ADDR.ToString();
                }
            }
            #endregion

            //主驾驶员的值进行检查
            #region
            //主驾驶员的值空的场合
            if (this.txt主驾驶员CD.Text.Trim() == string.Empty)
            {
                this.SetMessage("ZDH002", "IZDH002002", MSG_LEVEL.Error);
                this.AddCssClass(this.txt主驾驶员CD, CSS_TEXT_ERROR);
                this.txt主驾驶员CD.Focus();
                return;
            }
            else
            {
                //对主驾驶员进行查询
                CZDH002 instanceSelectStaff = new CZDH002();
                ZDH002DS.M_STAFFDataTable dtSelectStaff = instanceSelectStaff.GetJiaShiYuanDetail(this.txt主驾驶员CD.Text);
                if (dtSelectStaff.Count <= 0)
                {
                    //主驾驶员在员工表中不存在的场合，退出登陆
                    this.SetMessage("ZDH002", "IZDH002003", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt主驾驶员CD, CSS_TEXT_ERROR);
                    this.txt主驾驶员CD.Focus();
                    return;
                }
                else
                {
                    this.txt主驾驶员.Text = dtSelectStaff[0].STAFF_HANZI.ToString();
                    this.txt主驾驶员联系电话.Text = dtSelectStaff[0].MOBIL1.ToString();
                    this.txt主驾驶员驾龄.Text = dtSelectStaff[0].JIALING.ToString();
                    this.txt主驾驶员准驾类型.Text = dtSelectStaff[0].JIAZHAO_TYPE.ToString();
                }
            }
            #endregion

            //副驾驶员的值进行检查
            #region
            //副驾驶员的值空的场合
            if (this.txt副驾驶员CD.Text.Trim() == string.Empty)
            {
                this.SetMessage("ZDH002", "IZDH002004", MSG_LEVEL.Error);
                this.AddCssClass(this.txt副驾驶员CD, CSS_TEXT_ERROR);
                this.txt副驾驶员CD.Focus();
                return;
            }
            else
            {
                //对副驾驶员进行查询
                CZDH002 instanceSelectStaff = new CZDH002();
                ZDH002DS.M_STAFFDataTable dtSelectStaff = instanceSelectStaff.GetJiaShiYuanDetail(this.txt副驾驶员CD.Text);
                if (dtSelectStaff.Count <= 0)
                {
                    //副驾驶员在员工表中不存在的场合，退出登陆
                    this.SetMessage("ZDH002", "IZDH002005", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt副驾驶员CD, CSS_TEXT_ERROR);
                    this.txt副驾驶员CD.Focus();
                    return;
                }
                else
                {
                    this.txt副驾驶员.Text = dtSelectStaff[0].STAFF_HANZI.ToString();
                    this.txt副驾驶员联系电话.Text = dtSelectStaff[0].MOBIL1.ToString();
                    this.txt副驾驶员驾龄.Text = dtSelectStaff[0].JIALING.ToString();
                    this.txt副驾驶员准驾类型.Text = dtSelectStaff[0].JIAZHAO_TYPE.ToString();
                }
            }
            #endregion

            //执行更新
            #region
            Boolean isChanged = false;
            CZDH002 instance = new CZDH002();
            isChanged = instance.UpdateMChe( this.txt所属区分CD.Text, this.txt车主CD.Text, this.txt主驾驶员CD.Text, this.txt副驾驶员CD.Text
                                                 , this.txt运输形态CD.Text,"00" , this.txt车辆形态CD.Text, this.txt车辆状态CD.Text
                                                 , decimal.Parse(this.txt可承载重量.Text), decimal.Parse(this.txt车长.Text), decimal.Parse(this.txt车宽.Text)
                                                 , int.Parse(this.txt使用年数_Year.Text), this.txt年检有效日期_Year.Text
                                                 , this.txt备注.Text, this.txt车牌号.Text);
            if (!isChanged)
            {
                //更新失败
                String msg = MessageUtil.GetMessage("GTH001", "IGTH001002");
                lblMsgCD.Text = "IGTH001002";
                lblMsg.Text = msg;
                this.txt处理区分.Focus();
            }
            else
            {
                //更新成功
                String msg = MessageUtil.GetMessage("GTH001", "IGTH001000");
                lblMsgCD.Text = "IGTH001000";
                lblMsg.Text = msg;
                this.txt处理区分.Focus();
            }
            #endregion

            #endregion
        }
        else if (this.txt处理区分.Text == "9") //处理区分为1(删除)的场合
        {
            #region
            //删除时，各个控件的属性进行控制
            //proc清空_Init(this.txt处理区分.Text);

            //车牌号的值进行检查
            #region
            if (this.txt车牌号.Text.Trim() == string.Empty)
            {
                //车牌号为空的场合,退出登陆
                this.SetMessage("ZDH002", "IZDH002000", MSG_LEVEL.Error);
                this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                return;
            }
            else
            {
                //对车牌号进行查询
                CZDH002 instanceSelectMChe = new CZDH002();
                ZDH002DS.M_CHELIANGDataTable dtSelectMChe = instanceSelectMChe.GetMCHEDetail(this.txt车牌号.Text);
                if (dtSelectMChe.Count <= 0)
                {
                    //车牌号已存在场合,退出登陆
                    this.SetMessage("ZDH002", "IZDH002006", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt车牌号, CSS_TEXT_ERROR);
                    this.txt车牌号.Focus();
                    return;
                }
            }
            #endregion

            //执行删除
            Boolean isDeleted = false;
            CZDH002 instance = new CZDH002();
            isDeleted = instance.DeleteMChe(this.txt车牌号.Text);
            if (!isDeleted)
            {
                //删除失败
                String msg = MessageUtil.GetMessage("GTH004", "IGTH004002");
                lblMsgCD.Text = "IGTH004002";
                lblMsg.Text = msg;
                this.txt车牌号.Focus();
            }
            else
            {
                //删除成功
                String msg = MessageUtil.GetMessage("GTH004", "IGTH004000");
                lblMsgCD.Text = "IGTH004000";
                lblMsg.Text = msg;
                this.txt车牌号.Focus();
            }

            #endregion
        }
        else //处理区分为上述以外的场合
        {
            String msg = MessageUtil.GetMessage("GTH000", "IGTH000002");
            lblMsgCD.Text = "IGTH000002";
            lblMsg.Text = msg;
            return;
        }

    }

    protected void proc清空_Init(string str处理区分)
    {
        Label lblMsgCD = (Label)Master.FindControl("lblMsgCD");
        Label lblMsg = (Label)Master.FindControl("lblMsg");
        lblMsgCD.Text = "";
        lblMsg.Text = "";
        //this.SetMessage("", "", MSG_LEVEL.Info);

        //初期化
        if (str处理区分 == "0")
        {
            //控件的Enabled进行控制
            #region
            this.txt处理区分.Enabled = true;

            this.txt车牌号.Enabled = true;
            this.txt所属区分CD.Enabled = false;
            this.txt所属区分.Enabled = false;
            this.txt运输形态CD.Enabled = false;
            this.txt运输形态.Enabled = false;
            this.txt车辆形态CD.Enabled = false;
            this.txt车辆形态.Enabled = false;
            this.txt车辆状态CD.Enabled = false;
            this.txt车辆状态.Enabled = false;

            this.txt车长.Enabled = false;
            this.txt车宽.Enabled = false;
            this.txt可承载重量.Enabled = false;

            this.txt使用年数_Year.Enabled = false;
            this.txt使用年数_Month.Enabled = false;
            this.txt年检有效日期_Year.Enabled = false;
            this.txt年检有效日期_Month.Enabled = false;

            this.txt车主CD.Enabled = false;
            this.txt车主.Enabled = false;
            this.txt车主联系电话1.Enabled = false;
            this.txt车主联系电话2.Enabled = false;

            this.txt车主传真号.Enabled = false;
            this.txt车主邮箱.Enabled = false;

            this.txt主驾驶员CD.Enabled = false;
            this.txt主驾驶员.Enabled = false;
            this.txt主驾驶员联系电话.Enabled = false;
            this.txt主驾驶员驾龄.Enabled = false;
            this.txt主驾驶员准驾类型.Enabled = false;

            this.txt副驾驶员CD.Enabled = false;
            this.txt副驾驶员.Enabled = false;
            this.txt副驾驶员联系电话.Enabled = false;
            this.txt副驾驶员驾龄.Enabled = false;
            this.txt副驾驶员准驾类型.Enabled = false;

            this.txt备注.Enabled = false;
            #endregion

            //控件的Text进行清空
            #region
            this.txt处理区分.Text = string.Empty;
            this.txt处理区分.Focus();

            this.txt车牌号.Text = string.Empty;
            this.txt所属区分CD.Text = string.Empty;
            this.txt所属区分.Text = string.Empty;
            this.txt运输形态CD.Text = string.Empty;
            this.txt运输形态.Text = string.Empty;
            this.txt车辆形态CD.Text = string.Empty;
            this.txt车辆形态.Text = string.Empty;
            this.txt车辆状态CD.Text = string.Empty;
            this.txt车辆状态.Text = string.Empty;

            this.txt车长.Text = string.Empty;
            this.txt车宽.Text = string.Empty;
            this.txt可承载重量.Text = string.Empty;

            this.txt使用年数_Year.Text = string.Empty;
            this.txt使用年数_Month.Text = string.Empty;
            this.txt年检有效日期_Year.Text = string.Empty;
            this.txt年检有效日期_Month.Text = string.Empty;

            this.txt车主CD.Text = string.Empty;
            this.txt车主.Text = string.Empty;
            this.txt车主联系电话1.Text = string.Empty;
            this.txt车主联系电话2.Text = string.Empty;

            this.txt车主传真号.Text = string.Empty;
            this.txt车主邮箱.Text = string.Empty;

            this.txt主驾驶员CD.Text = string.Empty;
            this.txt主驾驶员.Text = string.Empty;
            this.txt主驾驶员联系电话.Text = string.Empty;
            this.txt主驾驶员驾龄.Text = string.Empty;
            this.txt主驾驶员准驾类型.Text = string.Empty;

            this.txt副驾驶员CD.Text = string.Empty;
            this.txt副驾驶员.Text = string.Empty;
            this.txt副驾驶员联系电话.Text = string.Empty;
            this.txt副驾驶员驾龄.Text = string.Empty;
            this.txt副驾驶员准驾类型.Text = string.Empty;

            this.txt备注.Text = string.Empty;
            #endregion
        }

        //查询
        if (str处理区分 == "1")
        {
            //控件的Enabled进行控制
            #region
            this.txt处理区分.Enabled = true;

            this.txt车牌号.Enabled = true;
            this.txt所属区分CD.Enabled = false;
            this.txt所属区分.Enabled = false;
            this.txt运输形态CD.Enabled = false;
            this.txt运输形态.Enabled = false;
            this.txt车辆形态CD.Enabled = false;
            this.txt车辆形态.Enabled = false;
            this.txt车辆状态CD.Enabled = false;
            this.txt车辆状态.Enabled = false;

            this.txt车长.Enabled = false;
            this.txt车宽.Enabled = false;
            this.txt可承载重量.Enabled = false;

            this.txt使用年数_Year.Enabled = false;
            this.txt使用年数_Month.Enabled = false;
            this.txt年检有效日期_Year.Enabled = false;
            this.txt年检有效日期_Month.Enabled = false;

            this.txt车主CD.Enabled = false;
            this.txt车主.Enabled = false;
            this.txt车主联系电话1.Enabled = false;
            this.txt车主联系电话2.Enabled = false;

            this.txt车主传真号.Enabled = false;
            this.txt车主邮箱.Enabled = false;

            this.txt主驾驶员CD.Enabled = false;
            this.txt主驾驶员.Enabled = false;
            this.txt主驾驶员联系电话.Enabled = false;
            this.txt主驾驶员驾龄.Enabled = false;
            this.txt主驾驶员准驾类型.Enabled = false;

            this.txt副驾驶员CD.Enabled = false;
            this.txt副驾驶员.Enabled = false;
            this.txt副驾驶员联系电话.Enabled = false;
            this.txt副驾驶员驾龄.Enabled = false;
            this.txt副驾驶员准驾类型.Enabled = false;

            this.txt备注.Enabled = false;
            #endregion

            //控件的Text进行清空
            #region
            this.txt车牌号.Focus();

            //this.txt车牌号.Text = string.Empty;
            this.txt所属区分CD.Text = string.Empty;
            this.txt所属区分.Text = string.Empty;
            this.txt运输形态CD.Text = string.Empty;
            this.txt运输形态.Text = string.Empty;
            this.txt车辆形态CD.Text = string.Empty;
            this.txt车辆形态.Text = string.Empty;
            this.txt车辆状态CD.Text = string.Empty;
            this.txt车辆状态.Text = string.Empty;

            this.txt车长.Text = string.Empty;
            this.txt车宽.Text = string.Empty;
            this.txt可承载重量.Text = string.Empty;

            this.txt使用年数_Year.Text = string.Empty;
            this.txt使用年数_Month.Text = string.Empty;
            this.txt年检有效日期_Year.Text = string.Empty;
            this.txt年检有效日期_Month.Text = string.Empty;

            this.txt车主CD.Text = string.Empty;
            this.txt车主.Text = string.Empty;
            this.txt车主联系电话1.Text = string.Empty;
            this.txt车主联系电话2.Text = string.Empty;

            this.txt车主传真号.Text = string.Empty;
            this.txt车主邮箱.Text = string.Empty;

            this.txt主驾驶员CD.Text = string.Empty;
            this.txt主驾驶员.Text = string.Empty;
            this.txt主驾驶员联系电话.Text = string.Empty;
            this.txt主驾驶员驾龄.Text = string.Empty;
            this.txt主驾驶员准驾类型.Text = string.Empty;

            this.txt副驾驶员CD.Text = string.Empty;
            this.txt副驾驶员.Text = string.Empty;
            this.txt副驾驶员联系电话.Text = string.Empty;
            this.txt副驾驶员驾龄.Text = string.Empty;
            this.txt副驾驶员准驾类型.Text = string.Empty;

            this.txt备注.Text = string.Empty;
            #endregion
        }

        //登记或订正
        if (str处理区分 == "2" || str处理区分 == "3")
        {
            //控件的Enabled进行控制
            #region
            this.txt处理区分.Enabled = true;

            this.txt车牌号.Enabled = true;
            this.txt所属区分CD.Enabled = true;
            this.txt所属区分.Enabled = false;
            this.txt运输形态CD.Enabled = true;
            this.txt运输形态.Enabled = false;
            this.txt车辆形态CD.Enabled = true;
            this.txt车辆形态.Enabled = false;
            this.txt车辆状态CD.Enabled = true;
            this.txt车辆状态.Enabled = false;

            this.txt车长.Enabled = true;
            this.txt车宽.Enabled = true;
            this.txt可承载重量.Enabled = true;

            this.txt使用年数_Year.Enabled = true;
            this.txt使用年数_Month.Enabled = true;
            this.txt年检有效日期_Year.Enabled = true;
            this.txt年检有效日期_Month.Enabled = true;

            this.txt车主CD.Enabled = true;
            this.txt车主.Enabled = false;
            this.txt车主.BackColor = System.Drawing.Color.LightGray; 
            this.txt车主联系电话1.Enabled = false;
            this.txt车主联系电话1.BackColor = System.Drawing.Color.LightGray; 
            this.txt车主联系电话2.Enabled = false;
            this.txt车主联系电话2.BackColor = System.Drawing.Color.LightGray;

            this.txt车主传真号.Enabled = false;
            this.txt车主传真号.BackColor = System.Drawing.Color.LightGray; 
            this.txt车主邮箱.Enabled = false;
            this.txt车主邮箱.BackColor = System.Drawing.Color.LightGray;

            this.txt主驾驶员CD.Enabled = true;
            this.txt主驾驶员.Enabled = false;
            this.txt主驾驶员.BackColor = System.Drawing.Color.LightGray;
            this.txt主驾驶员联系电话.Enabled = false;
            this.txt主驾驶员联系电话.BackColor = System.Drawing.Color.LightGray;
            this.txt主驾驶员驾龄.Enabled = false;
            this.txt主驾驶员驾龄.BackColor = System.Drawing.Color.LightGray;
            this.txt主驾驶员准驾类型.Enabled = false;
            this.txt主驾驶员准驾类型.BackColor = System.Drawing.Color.LightGray;

            this.txt副驾驶员CD.Enabled = true;
            this.txt副驾驶员.Enabled = false;
            this.txt副驾驶员.BackColor = System.Drawing.Color.LightGray;
            this.txt副驾驶员联系电话.Enabled = false;
            this.txt副驾驶员联系电话.BackColor = System.Drawing.Color.LightGray;
            this.txt副驾驶员驾龄.Enabled = false;
            this.txt副驾驶员驾龄.BackColor = System.Drawing.Color.LightGray;
            this.txt副驾驶员准驾类型.Enabled = false;
            this.txt副驾驶员准驾类型.BackColor = System.Drawing.Color.LightGray;

            this.txt备注.Enabled = true;
            #endregion

            //控件的Text进行清空
            #region

            #endregion
        }

        //删除
        if (str处理区分 == "9")
        {
            //控件的Enabled进行控制
            #region
            this.txt处理区分.Enabled = true;

            this.txt车牌号.Enabled = true;
            this.txt所属区分CD.Enabled = false;
            this.txt所属区分.Enabled = false;
            this.txt运输形态CD.Enabled = false;
            this.txt运输形态.Enabled = false;
            this.txt车辆形态CD.Enabled = false;
            this.txt车辆形态.Enabled = false;
            this.txt车辆状态CD.Enabled = false;
            this.txt车辆状态.Enabled = false;

            this.txt车长.Enabled = false;
            this.txt车宽.Enabled = false;
            this.txt可承载重量.Enabled = false;

            this.txt使用年数_Year.Enabled = false;
            this.txt使用年数_Month.Enabled = false;
            this.txt年检有效日期_Year.Enabled = false;
            this.txt年检有效日期_Month.Enabled = false;

            this.txt车主CD.Enabled = false;
            this.txt车主.Enabled = false;
            this.txt车主联系电话1.Enabled = false;
            this.txt车主联系电话2.Enabled = false;

            this.txt车主传真号.Enabled = false;
            this.txt车主邮箱.Enabled = false;

            this.txt主驾驶员CD.Enabled = false;
            this.txt主驾驶员.Enabled = false;
            this.txt主驾驶员联系电话.Enabled = false;
            this.txt主驾驶员驾龄.Enabled = false;
            this.txt主驾驶员准驾类型.Enabled = false;

            this.txt副驾驶员CD.Enabled = false;
            this.txt副驾驶员.Enabled = false;
            this.txt副驾驶员联系电话.Enabled = false;
            this.txt副驾驶员驾龄.Enabled = false;
            this.txt副驾驶员准驾类型.Enabled = false;

            this.txt备注.Enabled = false;
            #endregion

            //控件的Text不进行清空
            #region

            #endregion
        }
    }

    protected void txt处理区分_TextChange(object sender, EventArgs e)
    {
        Label lblMsgCD = (Label)Master.FindControl("lblMsgCD");
        Label lblMsg = (Label)Master.FindControl("lblMsg");

        //处理区分为空的场合
        if (this.txt处理区分.Text == string.Empty)
        {
            String msg = MessageUtil.GetMessage("GTH000", "IGTH000001");
            lblMsgCD.Text = "IGTH000001";
            lblMsg.Text = msg;
            return;
        }
        //处理区分为1,2,3,9的场合
        else if (this.txt处理区分.Text == "1" || this.txt处理区分.Text == "2" ||
            this.txt处理区分.Text == "3" || this.txt处理区分.Text == "9")
        {
            this.proc清空_Init(this.txt处理区分.Text);
        }
        //处理区分为上述以外的场合
        else
        {
            String msg = MessageUtil.GetMessage("GTH000", "IGTH000002");
            lblMsgCD.Text = "IGTH000002";
            lblMsg.Text = msg;
            return;
        }

    }

    protected void btn清除_Click(object sender, EventArgs e)
    {
        //初期化处理
        #region
        //查询时，各个控件的属性进行控制
        proc清空_Init("0");
        #endregion
    }


}